package cn.tude.xctf.boot2.controller;

import cn.tude.xctf.boot2.entity.Product;
import cn.tude.xctf.boot2.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@RestController 相当于controller注解的细化，在每一个方法上都加了@ResponseBody注解
@RestController
public class ProductController {
    @Autowired
    ProductMapper mapper;

    @RequestMapping("/insert")
    public String insert(Product product){
        System.out.println("product"+product);
        mapper.insert(product);
        return "添加成功";
    }

}
